#include "e2d/core/physics/components.h"
#include "e2d/core/Entity.h"

using namespace e2d::physics;

std::vector<std::string> Components::m_Labels= {
  
    e2d::RigidbodyDynamic::_Label_(),
    e2d::RevoluteJoint::_Label_(),
    e2d::FixedJoint::_Label_(),
    e2d::RigidbodyStatic::_Label_(),
};
   
bool Components::AddComponent(e2d::Entity* entity,const  ComponentType& type)
{
	bool flag{ 0 };

    flag |= entity->AddComponentFromType<e2d::RigidbodyDynamic>(type);
    flag |= entity->AddComponentFromType<e2d::RevoluteJoint>(type);
    flag |= entity->AddComponentFromType<e2d::FixedJoint>(type);
    flag |= entity->AddComponentFromType<e2d::RigidbodyStatic>(type);
	return flag;
}

bool Components::CopyComponents(const e2d::Entity* source, e2d::Entity* target)
{
    bool flag{0};

    flag|= target->CopyComponent<e2d::RigidbodyDynamic>(source);
    flag|= target->CopyComponent<e2d::RevoluteJoint>(source);
    flag|= target->CopyComponent<e2d::FixedJoint>(source);
    flag|= target->CopyComponent<e2d::RigidbodyStatic>(source);
    return flag;
};

